Skip to content

Update java-basic-questions-01.md#2882

Open
JasonZhangZx wants to merge 1 commit into
Snailclimb:mainfrom
JasonZhangZx:patch-1
Open

Update java-basic-questions-01.md#2882
JasonZhangZx wants to merge 1 commit into
Snailclimb:mainfrom
JasonZhangZx:patch-1

Conversation

@JasonZhangZx

Copy link
Copy Markdown

静态成员变量在方法区(元空间),下文还有2个插图也描述的是堆

静态成员变量在方法区(元空间),下文还有2个插图也描述的是堆

@daltino daltino left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change clarifies an important distinction regarding the location of static variables in memory, correcting the explanation for versions after JDK 1.7 by specifying the "method area" instead of the heap. This update improves the technical accuracy of the documentation.

@Snailclimb Snailclimb left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢修正这段说明,不过当前替换后的表述仍不准确,麻烦再调整后提交:

  • HotSpot 的永久代是在 JDK 8 才移除,而不是 JDK 1.7;
  • OpenJDK 的 JEP 122 说明,移除永久代后,类静态变量移至 Java 堆,类元数据移至本地内存;
  • “方法区”是 JVM 规范中的逻辑运行时区域,不能直接替代这里关于 HotSpot 实现存储位置的描述。

建议将这一小节整体改为区分“JVM 规范的逻辑概念”和“HotSpot 在不同 JDK 版本的实现”,并一并核对 PR 描述中提到的两张插图。参考:https://openjdk.org/jeps/122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants